{template '../../header'}
{template '../../left'}

<div class="card">
    <div class="card-header">
        修改角色
    </div>
    <div class="card-body">
        <form method="post" class="form-row">
            <div class="form-group col-2">
                <label>父级角色</label>
                <select id="parent_id" name="parent_id" class="form-control form-control-sm">
                    <option value="0">--请选择--</option>
                    {loop $parent_routes $route}
                    <option value="<?php echo $route['id']; ?>" <?php echo $detail['parent_id'] == $route['id']?'selected':''; ?>><?php echo $route['title']; ?></option>
                    {/loop}
                </select>
            </div>
            <div class="form-group col-2">
                <label>角色名称</label>
                <input class="form-control form-control-sm" type="text" id="title" name="title" value="<?php echo $detail['title']; ?>" />
            </div>
            <div class="form-group col-2">
                <label>排序</label>
                <input class="form-control form-control-sm" type="text" id="sort" name="sort" value="<?php echo $detail['sort']; ?>" />
            </div>
            <div class="form-group col-2">
                <label>锁定状态</label>
                <select id="state" name="state" class="form-control form-control-sm">
                    <option value="0" <?php if($detail['state'] == '0'){echo 'selected';} ?>>开放</option>
                    <option value="1" <?php if($detail['state'] == '1'){echo 'selected';} ?>>锁定</option>
                </select>
            </div>
            <div class="form-group col-4">
                <label>角色描述</label>
                <input class="form-control form-control-sm" type="text" id="comment" name="comment" value="<?php echo $detail['comment']; ?>" />
            </div>
            <div class="form-group col-12">
                <label>权限分配</label>
                {loop $routes $route}
                {template './role_route_tpl'}
                {/loop}
            </div>
            <div class="form-group col-2">
                <button type="submit" class="btn btn-success btn-sm" name="op" value="save"><i class="fa fa-save"></i> 保存</button>
            </div>
        </form>
    </div>
</div>


{template '../../footer'}